package org.example.Service;

import org.example.mapper.ProductMapper;
import org.example.pojo.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService{
    @Autowired
    private ProductMapper productMapper;
    @Override
    public List<Product> selectProducts() {
        return productMapper.selectProducts();
    }

    @Override
    public Product selectProductByID(Integer id) {
        return productMapper.selectProductByID(id);
    }

    @Override
    public Product selectProductByName(String name) {
        return productMapper.selectProductByName(name);
    }

    @Override
    public int insertProduct(Product product) {
        return productMapper.insertProduct(product);
    }

    @Override
    public int updateProduct(Product product) {
        return productMapper.updateProduct(product);
    }

    @Override
    public int deleteProduct(Integer id) {
        return productMapper.deleteProduct(id);
    }
}
